package manager
{
	import flash.external.ExternalInterface;

	public class DesktopManager
	{
		public function DesktopManager()
		{
		}
		private var _desktopType:int;
		
		private static var _instance:DesktopManager;
		public static function get Instance():DesktopManager
		{
			if(_instance == null)
			{
				_instance = new DesktopManager();
			}
			return _instance;
		}
		
		public function checkIsDesktop():void
		{
//			你发给我 IsDesktop
//			我回应调用你的函数 SetIsDesktop
			if(ExternalInterface.available)
			{
				ExternalInterface.addCallback("SetIsDesktop",SetIsDesktop);
				ExternalInterface.call("IsDesktop");
				
			}
		}
		
		private function SetIsDesktop():void
		{
			_desktopType = 1;
		}
		
		public function get isDesktop():Boolean
		{
			return _desktopType>0;
		}
		
		public function get desktopType():int
		{
			return _desktopType;
		}
		
		public function backToLogin():void
		{
			ExternalInterface.call("WindowReturn");
		}
	}
}